package com.huluobo.sign

import com.huluobo.lib_base.BaseViewModel
import com.huluobo.lib_base.Res
import com.huluobo.lib_base.UIIntent
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

/**
 *  Created by LC on 2025/3/15.
 */
@HiltViewModel
class SignViewModel @Inject constructor(private val signRepo: SignRepo) : BaseViewModel<SignIntent>() {
    override fun handleIntent(it: UIIntent) {
        when (it) {
            is SignIntent.GetSigns -> {
                httpRequest(signRepo.getSigns(it.page, it.limit) as Flow<Res<Any>>)
            }

            is SignIntent.AddSign -> {
                httpRequest(signRepo.addSign(it.map))
            }
        }
    }
}